﻿using RaytracerLib.MathLib;
using RaytracerLib.Script;

namespace RaytracerLib.Layers
{
    public abstract class LayerScript
    {
        public ScriptParams Params { get; private set; }

        protected LayerScript()
        {
            Params = new ScriptParams(this);
        }

        public virtual ColorFloat GetColor(Vector2 a_uv, Intersection a_intersection)
        {
            return new ColorFloat(GetValue(a_uv, a_intersection));
        }

        public virtual double GetValue(Vector2 a_uv, Intersection a_intersection)
        {
            return GetColor(a_uv, a_intersection).Avg;
        }

        public virtual Tangents GetTangents(Vector2 a_uv, Vector2 a_tx, Vector2 a_ty,
            Intersection a_intersection)
        {
            throw new System.NotImplementedException();
        }

        public virtual void RenderStart(RenderStartPhase a_phase)
        {
        }
    }
}